Prevent opening the xenbus device if the store isn't connected yet.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 13 Sep 2005 10:05:49 +0000 (10:05 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 13 Sep 2005 10:05:49 +0000 (10:05 +0000)
Running xenstore clients using the xenbus device before the store
connection has been set up causes a crash because the store page
won't have been allocated yet.  This is only a problem in dom0 where
we setup the store page from the PRIVCMD_INITDOMAIN_STORE ioctl.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c

index fd5ab73fe90465638461a48090fca25e87393eb7..c5bdeb4e8c6e3e8f87921007eb82a101fa84670e 100644 (file)
@@ -130,6 +130,9 @@ static int xenbus_dev_open(struct inode *inode, struct file *filp)
 {
        struct xenbus_dev_data *u;
 
+       if (xen_start_info->store_evtchn == 0)
+               return -ENOENT;
+
        /* Don't try seeking. */
        nonseekable_open(inode, filp);